dir="/mnt/nas/datasets/diction"
dates=("0916" "0917")  # 正确的数组定义方式
categories=("paike" "trench" "leafur")

# 初始化一个关联数组来存储每个类别的总clo(diff)数量
declare -A category_totals

for category in "${categories[@]}"; do
    # 初始化当前类别的总和为0
    category_totals[$category]=0

    # leather 到 0825 为止 if date > 0825 and category=leather then continue

    for date in "${dates[@]}"; do

        count=$(grep -c "\.jpg" "$dir"/"$category""$date"_img/names.txt)
        count2=$(grep -c "\.jpg" "$dir"/"$category""$date"_img_clo/names.txt)
        count3=$(grep -c "\.jpg" "$dir"/"$category""$date"_img_clo_diff/names.txt)

        # 累加到当前类别的总和中
        category_totals[$category]=$((category_totals[$category] + count3))

        echo $category "Date: $date, JPG count: $count"
        echo $category "Date: $date clo(diff+sim), JPG count: $count2"
        echo $category "Date: $date clo(diff), JPG count: $count3"
        # echo
    done
done    

# 输出每个类别的clo(diff)总数量
echo "---> Total clo(diff) counts per category: <---"
for category in "${categories[@]}"; do
    echo "$category: ${category_totals[$category]}"
done


dates=("0917" "0918" "0919" 
        "0922" "0923" "0924")  # 正确的数组定义方式
categories=("slipdress")

# 初始化一个关联数组来存储每个类别的总clo(diff)数量
declare -A category_totals

for category in "${categories[@]}"; do
    # 初始化当前类别的总和为0
    category_totals[$category]=0

    # leather 到 0825 为止 if date > 0825 and category=leather then continue

    for date in "${dates[@]}"; do

        count=$(grep -c "\.jpg" "$dir"/"$category""$date"_img/names.txt)
        count2=$(grep -c "\.jpg" "$dir"/"$category""$date"_img_clo/names.txt)
        count3=$(grep -c "\.jpg" "$dir"/"$category""$date"_img_clo_diff/names.txt)

        # 累加到当前类别的总和中
        category_totals[$category]=$((category_totals[$category] + count3))

        echo $category "Date: $date, JPG count: $count"
        echo $category "Date: $date clo(diff+sim), JPG count: $count2"
        echo $category "Date: $date clo(diff), JPG count: $count3"
        # echo
    done
done    

# 输出每个类别的clo(diff)总数量
echo "---> Total clo(diff) counts per category: <---"
for category in "${categories[@]}"; do
    echo "$category: ${category_totals[$category]}"
done


dates=("0917" "0918" "0919"
        "0922" "0923" "0924" "0925" "0926" 
        "0928" "0929" "0930")  # 正确的数组定义方式
categories=("dress")

# 初始化一个关联数组来存储每个类别的总clo(diff)数量
declare -A category_totals

for category in "${categories[@]}"; do
    # 初始化当前类别的总和为0
    category_totals[$category]=0

    # leather 到 0825 为止 if date > 0825 and category=leather then continue

    for date in "${dates[@]}"; do

        count=$(grep -c "\.jpg" "$dir"/"$category""$date"_img/names.txt)
        count2=$(grep -c "\.jpg" "$dir"/"$category""$date"_img_clo/names.txt)
        count3=$(grep -c "\.jpg" "$dir"/"$category""$date"_img_clo_diff/names.txt)

        # 累加到当前类别的总和中
        category_totals[$category]=$((category_totals[$category] + count3))

        echo $category "Date: $date, JPG count: $count"
        echo $category "Date: $date clo(diff+sim), JPG count: $count2"
        echo $category "Date: $date clo(diff), JPG count: $count3"
        # echo
    done
done    

# 输出每个类别的clo(diff)总数量
echo "---> Total clo(diff) counts per category: <---"
for category in "${categories[@]}"; do
    echo "$category: ${category_totals[$category]}"
done
